public class EdgeWeightComparator extends java.lang.Object implements java.util.Comparator<Edge>
| Modifier and Type | Field and Description |
|---|---|
private boolean |
ascending
Indicates if the comparator should sort elements in ascending order.
|
| Constructor and Description |
|---|
EdgeWeightComparator(boolean ascending)
Constructs an EdgeWeightComparator.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(Edge o1,
Edge o2)
Compares the edges based on the D data held by the edge.
|
private java.math.BigDecimal |
toNumber(java.lang.Object object)
Converts an unknown object into a BigDecimal if possible.
|
private final boolean ascending
public EdgeWeightComparator(boolean ascending)
ascending - boolean indicating if edges should be sorted in
ascending order.public int compare(Edge o1, Edge o2)
compare in interface java.util.Comparator<Edge>o1 - the first edge to compare.o2 - the second edge to compare.private java.math.BigDecimal toNumber(java.lang.Object object)
object - the Object to convert.